package Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test1 {
    //随机点名器
    //需求：70%概率男生，30%概率女生
    public static void main(String[] args) {
        //创建集合，存储数字，代表概率
        ArrayList<Integer> list=new ArrayList<>();
        Collections.addAll(list,1,1,1,1,1,1,1,0,0,0);
        Random r=new Random();
        int index=r.nextInt(list.size());
        int num=list.get(index);
        System.out.println(num);

        //创建两个集合，分别代表男和女
        ArrayList<String> boylist=new ArrayList<>();
        ArrayList<String> girllist=new ArrayList<>();
        Collections.addAll(boylist,"男6","男5","男4","男3","男2","男1");
        Collections.addAll(girllist,"女6","女5","女4","女3","女2","女1");

        //判断数字，输出对应的男或女

        if(num==1){
            int boynum=r.nextInt(boylist.size());

            String name=boylist.get(boynum);
            System.out.println(name);
        }
        else{
            int girlnum=r.nextInt(girllist.size());

            String name=girllist.get(girlnum);
            System.out.println(name);
        }
    }
}
